/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package observer;

import cbaApplication.*;
import commonSources.Painel;
import javax.swing.Icon;
import javax.swing.ImageIcon;

/**
 *
 * @author Filipe
 */
public class ObserverPubImage implements IObserver {

    private Painel panel;
    private final CBA cba;

    public ObserverPubImage(CBA cba) {
        this.cba = cba;
    }

    public Painel getState() {
        return panel;
    }

    public void setState(Painel panel) {
        this.panel = panel;
    }

    public void update(Painel panel) {
        setState(panel);
        System.out.println(getState().getPathToImage());
        Icon image = new ImageIcon(getClass().getResource("/images/"+getState().getPathToImage()));
        cba.getUi().getLabelPubImage().setIcon(image);
        
    }
}




